package com.bestcem.xm.member.enums;

/**
 * @author dc.wang <dc.wang@idiaoyan.com>
 * @version V1.0
 * @description 联系人展示范围类型枚举
 * @date 2021/7/19
 */
public enum DisplayRangeTypeEnum {
    // 所有人可见
    ALL(0),

    // 仅企业管理员可见
    ADMIN(1);

    private final int index;

    DisplayRangeTypeEnum(int index){
        this.index = index;
    }

    public int value(){
        return index;
    }

    public boolean matches(int index){
        return this.index == index;
    }

    public static DisplayRangeTypeEnum getByIndex(Integer index){
        if(index == null){
            return null;
        }
        for(DisplayRangeTypeEnum e : DisplayRangeTypeEnum.values()){
            if(index.equals(e.index)){
                return e;
            }
        }
        return null;
    }
}
